﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DNEL.Extensions
{
    /// <summary>
    /// 
    /// </summary>
    public static class EventHandlerExtensions
    {
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="eh"></param>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <example>
        /// <code>
        /// MyEvent.Raise(this, e);
        /// </code>
        /// </example>
        public static void Raise<T>(this EventHandler<T> eh, object sender, T e) where T : EventArgs
        {
            if (!eh.IsNull())
            {
                eh(sender, e);
            }
        }
    }
}
